For this Pre-Interview Exercise, I utilized machine learning techniques to generate business value from a data set of hotel bookings. I used supervised learning algorithms to solve the regression problem of predicting the cost of a hotel booking [ perspective of the guests ] and the classification problem of predicting whether or not a hotel booking will be canceled [ perspective of the hotel owner ]. I also used the unsupervised learning technique of clustering to perform customer segmentation [ Trying to discover the hidden insight ].
I started by determining how we should tackle this problem to focus on for this usecase. Here I am going to use both:
There are numerous other types of machine learning problems but regression, classification, and clustering are perhaps the most common business use cases for machine learning. Thus, I wanted to focus on these three problem types to ensure that the machine learning techniques I utilize in this project are applicable to a wide variety of practical business problems.
I then specified the requirements for the data set I would work with in this exercise. These requirements are listed below.
The data set must:
It's already been supplied with the pre-interview exercise.
I then created a data profile report to explore the contents of the hotel bookings data set.
import pandas as pd
import os
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
# Visualization
import plotly.express as px
import plotly.graph_objects as go
import plotly.io as pio
pio.renderers.default='notebook'
# Import package used for data manipulation in Python
import pandas
# Import package used for exploratory data analysis
from pandas_profiling import ProfileReport
# Import the data set (as a CSV file) into a pandas DataFrame
raw_data = pandas.read_csv('hotel_bookings.csv', index_col=False)
df = raw_data.copy()
# Create and display a report summarizing the data in the hotel bookings data set
profile = ProfileReport(raw_data,
title='Hotel Bookings Data Profile Report',
html={'style': {
'full_width': True
}})
profile.to_notebook_iframe()